package com.tim.proxy;

import java.lang.reflect.Proxy;

public class JdkReflectService implements IJdkReflectService {
	private static final JdkReflectService instance = new JdkReflectService();

	public static JdkReflectService getInstance() {
		return instance;
	}

	public void analogRemoveInfo() throws InterruptedException {
		// PerformanceMonitoring.begin("analogRemoveInfo");//性能监测
		Thread.sleep(200);// 模拟该方法执行了200毫秒
		// PerformanceMonitoring.end();//结束性能监测
	}

	public void testAnalogRemoveInfo() throws InterruptedException {
		IJdkReflectService target = JdkReflectService.getInstance();
		PerformaceHandler handler = new PerformaceHandler(target);
		IJdkReflectService proxy = (IJdkReflectService) Proxy.newProxyInstance(
				target.getClass().getClassLoader(), target.getClass()
						.getInterfaces(), handler);
		proxy.analogRemoveInfo();
	}
}
